<template>
<div class="wdjq">

    <van-cell-group>
        <van-nav-bar :fixe="true" :placeholder="true" title="个人假期汇总" left-text="返回" left-arrow @click-left="onClickLeft" />
    </van-cell-group>

    <van-cell-group v-for="(item,index) in list" :key="index">
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_PERSONAL'" title="事假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_VISIT_SPOUSE'" title="探亲假(配偶)" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_VISIT_PARENT'" title="探亲假(父母)" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_CONTRACEPTION'" title="节育假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_FUNERAL'" title="丧假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row  v-if="item.recordType == 'LEAVE_COMPENSATED'">
            <van-col span="16" style="font-color:#00F">
                <van-cell title="调休假" :value='`已休${item.usedTime}天`' />
            </van-col>
            <van-col  span="8">
                <van-cell  :value='`未休${Number(item.sumTime) - Number(item.usedTime)}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_BREASTFEEDING'" title="哺乳假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row  v-if="item.recordType == 'LEAVE_ANNUAL'">
            <van-col span="16" style="font-color:#00F">
                <van-cell title="年假" :value='`已休${item.usedTime}天`' />
            </van-col>
             <van-col  span="8">
                <van-cell  :value='`未休${Number(item.sumTime) - Number(item.usedTime)}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_MARRIAGE'" title="婚假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_NURSING'" title="护理假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_MATERNITY'" title="产假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_PATERNITY'" title="陪产假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>
        <van-row>
            <van-col span="16" style="font-color:#00F">
                <van-cell v-if="item.recordType == 'LEAVE_SICK'" title="病假" :value='`已休${item.usedTime}天`' />
            </van-col>
        </van-row>

            
        
    </van-cell-group>

    <van-tabbar v-model="active1">
        <van-tabbar-item icon="home-o" to='/index'>首页</van-tabbar-item>
        <van-tabbar-item icon="search" to='/bl'>办理</van-tabbar-item>
        <van-tabbar-item icon="friends-o" to='/indexxj'>新建</van-tabbar-item>
        <!-- <van-tabbar-item icon="setting-o">统计</van-tabbar-item> -->
        <van-tabbar-item icon="setting-o" to='/wode'>我的</van-tabbar-item>
    </van-tabbar>
</div>
</template>

<script>
import Cookies from "js-cookie";
import {
    findList,
    myLeaveStatistics
} from "@/api/fy";
import {
    Transformation
} from "@/api/common";
export default {
    data() {
        return {

            active: 0,
            active1: 3,
            currentDate: new Date(), //开始标准时间
            data: '',
            list: ''

        };
    },
    created() {
        this.getmyLeaveStatistics(this.currentDate.getFullYear());

    },
    methods: {

        onClickLeft() {
            this.$router.go(-1);
        },
        getmyLeaveStatistics(Year) {
            const obj = {
                page: 1,
                limit: 100,
                dateYear: Year
            };
            myLeaveStatistics(obj)
                .then(res => {
                    this.data = res.data
                    this.list = res.data
                })
                .catch(function (error) {
                    console.log(error);
                });
        },
    }
};
</script>

